import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;

import gui.EarthPanel;
import gui.UserControlPanel;

import common.Constants;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class EarthSim extends JFrame {
  private static final long serialVersionUID = 3386230071400230901L;

  private Container contentPane = getContentPane();

  /** Creates a new instance of GUIPlate */
  public EarthSim() {
    super("Earth Heat Simulation");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(Constants.FRAME_WIDTH, Constants.FRAME_HEIGHT));
    setLocation(0, 200);
  }


  private void createAndShowGUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

    EarthPanel pnlEarth = new EarthPanel();

    String initiative = "-r";
    UserControlPanel pnlControls = new UserControlPanel(pnlEarth, initiative);
    pnlControls.setAlignmentX(Component.LEFT_ALIGNMENT);

    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
    contentPane.add(pnlControls);
    contentPane.add(pnlEarth);
    setVisible(true);
  }


  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        new EarthSim().createAndShowGUI();
      }
    });
  }
}
